Browser
A web browser control that allows loading a web page or a local HTML file, accessing DOM and executing JavaScript on the loaded web page, getting notifications about loading progress, dispatching keyboard and mouse events, etc.
The Browser
instance itself is running in a separate native process that allocates memory and system resources that must be released. So, when a Browser
instance is no longer needed, it must be closed through the close method to release all the allocated memory and system resources. For example:
Browser browser = engine.newBrowser();
...
browser.close();
Any attempt to use an already closed Browser
instance will lead to the
IllegalStateException
.
The Browser
instance is closed automatically when its Engine is closed or unexpectedly crashed. If the instance represents a popup window created by JavaScript via the window.open()
function, then JavaScript can close the instance using the
window.close()
function.
To get notifications that the Browser
instance has been closed please subscribe to the following event:
browser.on(BrowserClosed.class, event -> {
// The Browser instance has been closed.
});
Properties
Returns the default JavaScript PresentationRequest
specified on the page.
Returns the focused frame on the currently loaded web page, if any.
Returns the service that controls the fullscreen mode.
Returns Navigation of this Browser.
Returns a rendering mode of this Browser.
Returns settings that configure this Browser.
Returns the service that allows searching text on a currently loaded web page.
Functions
receiver
.receiver
.options
.PresentationRequest
specified on the page.Optional
that contains the focused Frame
on the currently loaded web page, otherwise an empty Optional
.Navigation
that allows controlling navigation in the current browser instance.
word
.BrowserSettings
that allows configuring the current browser instance.Subscribes the given observer to receive events of type E from this Observable.
TextFinder
that allows finding text on a web page loaded in the current browser instance.